<?php
/* @var $this RecetaController */
/* @var $model Receta */

$this->breadcrumbs=array(
	'Recetas'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'Crear Receta', 'url'=>array('receta/create','id'=>$id)),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#receta-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<?php if (isset($model)):?>
	<h4>Recetas de: <?php echo $model->cliente; ?></h4>
<?php else : ?>
	<h4>Sin Recetas</h4>
<?php endif;?>
<div class="search-form" style="display:none">

</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'receta-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		//'idReceta',
		array('name'=>'fecha',
			  'value'=>'Yii::app()->dateFormatter->format("dd/MM/yyyy",strtotime($data->fecha))',
				),
		//array('value'=>'$data->cliente0->fullName',),
		array('name'=>'medico','value'=>'isset($data->medico0->nombre)?$data->medico0->nombre:""'),
		//'sucursal',
		'observacion',
		array(
			'class'=>'CButtonColumn',
			'template'=>'{view}{update}{delete}',
			'buttons'=>array(
					'view'=>array('url'=>'$this->grid->controller->createUrl("/receta/view", array("id"=>$data->idReceta,))'),
					'update'=>array('url'=>'$this->grid->controller->createUrl("/receta/update", array("id"=>$data->idReceta,))'),
					'delete'=>array('url'=>'$this->grid->controller->createUrl("/receta/delete", array("id"=>$data->idReceta,))')
						),
		),
	),
)); ?>
